<template>
	<div class="mazmun">
		<banner :list="toplamList"></banner>
		<scroll>
			<gridList :list='mazmunList'></gridList>
		</scroll>
	</div>
</template>

<script>
	import {
		getMazmunListData
	} from '@/api/mazmun.js'
	import banner from '@/components/mazmun/banner.vue'
	import gridList from '@/components/mazmun/gridList.vue'
	import scroll from '@/components/mazmun/scroll.vue'
	export default {
		components: {
			banner,
			gridList,
			scroll,
		},
		data() {
			return {
				toplamList: [],
				mazmunList: [],
			}
		},
		async mounted() {
			this.$emit('setLoading', true)
			await this.getMazmunList()
			this.$emit('setLoading', false)
		},
		methods: {
			async getMazmunList() {
				const res = await getMazmunListData()
				if (res) {
					console.log(res);
					this.toplamList = res.data.list.toplam
					this.mazmunList = res.data.list.mazmun
				} else {
					uni.showToast({
						title: '请求失败',
						icon: 'error'
					})
				}
			}
		},
	}
</script>

<style lang="scss" scoped>
	.mazmun {}
</style>